<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>底部导航菜单切换</title>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<script src="js/jquery.min-1.11.1.js"></script>
		<script src="js/request.js"></script>
		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" href="css/iconfont.css">
	</head>
	<body>
		<nav class="mui-bar mui-bar-tab " id="nav">
			<a class="mui-tab-item mui-active" id="a1">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item " id="a2">
				<span class="mui-icon icon iconfont">&#xe533;</span>
				<span class="mui-tab-label">随访查询</span>
			</a>
			<a class="mui-tab-item " id="a3">
				<span class="mui-icon icon iconfont">&#xe607;<span class="mui-badge"></span></span>
				<span class="mui-tab-label">随访提醒</span>
			</a>
			<a class="mui-tab-item " id="a4">
				<span class="mui-icon icon iconfont">&#xe508;</span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript" charset="utf-8">
			//获取变量
 			var self = localStorage.getItem("name")
 			var data = JSON.parse(self)
			//获取提醒信息
				$.ajax(getRequestUrl.url+'/mobile/ChronicWarning/getChronicWarning ',{
					data:{
						hosp_id:data["obj"].hospId,
						region_id:data["obj"].regionId,
						warning_day:700
					},
					dataType:'json',//服务器返回json格式数据
					type:'post',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					success:function(data){
						$(".mui-badge").text(data["rows"].length)
					},error:function(xhr,type,errorThrown){
					
					}
				})
			//修改 .theirs
			mui.init({
				    subpages:[//先加载首页
				    	{
					      url:'examples2/default.html',
					      id:'a1',
					      styles:{
					      	 top:'0px',
		        				bottom:'60px'
					      }
					    }
				   		
				    ],
				    preloadPages:[//缓存其他页面
					    {
							url:'examples2/follow_query.html',
							id:'a2',
							styles:{
								top:'0px',
								bottom:'60px'
							}
					    },
					    {
							url:'examples2/remind.html',
							id:'a3',
							styles:{
								 top:'0px',
								bottom:'60px'
							}
					    },
						{
							url:'examples2/admin.html',
							id:'a4',
							styles:{
								 top:'0px',
								bottom:'60px'
							}
						}
				 	]
				    
				});
			mui.plusReady(function(){ 
				// 获取所有Webview窗口
				var winAll=plus.webview.all();//获取所有窗体
				//console.log(JSON.stringify(winAll)) 
				var a1,a2,a3,a4
				mui("#nav").on("tap","#a1",function(){//点击触发 
					a1=plus.webview.getWebviewById("a1");
					a2=plus.webview.getWebviewById("a2");
					a3=plus.webview.getWebviewById("a3");
					a4=plus.webview.getWebviewById("a4");
					a1.show();
					a2.hide();//这一步必须有
					a3.hide();//这一步必须有
					a4.hide();
				})
				mui("#nav").on("tap","#a2",function(){//点击触发
					a2=plus.webview.getWebviewById("a2");
					a2.show()
				})
				mui("#nav").on("tap","#a3",function(){//点击触发
					a3=plus.webview.getWebviewById("a3");
					a3.show();
					$(".mui-badge").remove();
				})
				mui("#nav").on("tap","#a4",function(){//点击触发
					a4=plus.webview.getWebviewById("a4");
					a4.show()
				})
			});
		</script>
		
	</body>
</html>
